1206C - Almost Equal - CodeForces Solution


constructive algorithms math *1200

Please click on ads to support us..

C++ Code:

// Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
int main() {
    // Write C++ code here
    // std::cout << "Hello world!";
    int n;
    cin>>n;
    if(n%2==0){
        cout<<"NO"<<endl;
    }
    else{
        cout<<"YES"<<endl;
        for(int i=1;i<=(n-1)/2;i++){
            cout<<(4*i)-3<<" "<<4*i<<" ";
        }
        cout<<(2*n)-1<<" ";
        for(int i =1;i<=(n-1)/2;i++){
            cout<<(4*i)-2<<" "<<(4*i)-1<<" ";
        }
        cout<<2*n<<endl;
    }
    return 0;
}


Comments

Submit
0 Comments
More Questions

429A - Xor-tree
1675C - Detective Task
950A - Left-handers Right-handers and Ambidexters
672B - Different is Good
1C - Ancient Berland Circus
721A - One-dimensional Japanese Crossword
1715B - Beautiful Array
60B - Serial Time
453A - Little Pony and Expected Maximum
1715A - Crossmarket
1715C - Monoblock
1512C - A-B Palindrome
1679B - Stone Age Problem
402A - Nuts
792A - New Bus Route
221A - Little Elephant and Function
492C - Vanya and Exams
1369B - AccurateLee
892B - Wrath
999A - Mishka and Contest
727C - Guess the Array
1625C - Road Optimization
1715D - 2+ doors
267A - Subtractions
1582A - Luntik and Concerts
560A - Currency System in Geraldion
946A - Partition
1068B - LCM
1692E - Binary Deque
679A - Bear and Prime 100